package com.zhongkai.controller;

import com.zhongkai.app.service.SellStockService;
import com.zhongkai.model.utils.ZhongkaiResult;
import com.zhongkai.model3.Chinaset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 销售出库
 * */
@Controller
public class SellStockController {

    @Autowired
    private SellStockService sellStockService;

    /**
     * 销售出库
     *
     * @param uuid     销售订单uuid
     */
    @RequestMapping(value = "/sell_storage/out", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult outStorage(String uuid
    ,HttpServletRequest httpServletRequest
    ) {

        Chinaset chinaset = (Chinaset) httpServletRequest.getAttribute("user");
        ZhongkaiResult result = sellStockService.outStorage(uuid,chinaset.getSetName(),chinaset.getUuid());

        return result;
    }


    /**
     * 已审批列表
     *
     */
    @RequestMapping(value = "/sell_storage/list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listStorage(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows) {


        ZhongkaiResult result = sellStockService.listStorage(page,rows);

        return result;
    }
}
